import { API_LIST } from '../../Api/Api'
import { TwoAddBtn, ThrDeleteBtn } from '../options'

export const DeviceCamera = async ({ upDataEvent, data }) => {
    let dataList = {
        type: '摄像头列表',
        hideInSearch: true,
        pageSize: 10,
        params: {},
        classification: 'TableModal',
        get: API_LIST([data.uuid])['getDeviceCameras'],
        options: [
            <TwoAddBtn
                upDataEvent={upDataEvent}
                title="添加摄像头"
                ThrKey="ThrModal"
                value="DeviceCamera"
                data={data}
            />,
        ],
        columns: [
            {
                dataIndex: 'uuid',
                title: '编号',
                type: 'hidden',
                hidden: true,
                hideInTable: true,
                hideInSearch: true,
            },
            {
                dataIndex: 'deviceUuid',
                title: '试验编号',
                type: 'hidden',
                hidden: true,
                hideInTable: true,
                hideInSearch: true,
            },
            {
                dataIndex: 'cameraUuid',
                title: '摄像头编号',
                type: 'hidden',
                hidden: true,
                hideInTable: true,
                hideInSearch: true,
            },
            {
                dataIndex: 'cameraName',
                title: '名称',
                rules: true,
                type: 'input',
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 220,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <ThrDeleteBtn
                            key="delete"
                            record={record.uuid}
                            upDataEvent={upDataEvent}
                            data={{ key: 'delete', url: 'delDeviceCameras', title: '删除摄像头' }}
                        />,
                    ]
                },
            },
        ],
    }
    return dataList
}
